<#import "/spring.ftl" as spring />
<html>
<head>

</head>
<body>

<div id="content">

	<h1>INVOICE</h1>
	
	<table>
	<tr>
		<td>Invoice Period Start: </td>
		<td>${invoice.invoicePeriodStartDate?string("EEEE, MMMM d, yyyy")}</td>
	</tr>
	<tr>
		<td>Invoice Period End: </td>
		<td>${invoice.invoicePeriodEndDate?string("EEEE, MMMM d, yyyy")}</td>
	</tr>
	<tr>
		<td>Invoice Amount</td>
		<td>$${invoice.calculateInvoiceAmount()}</td>
	</tr>
	<tr>
		<td>Payment Status</td>
		<#if payment??>
			<td>PAID <a href="../viewPayment.html?id=${payment.id}">payment details</a></td>
		<#else>
			<td>NOT PAID <a href="initiateInvoicePayment.html">pay now</a></td>
		</#if>		
	</tr>
	</table>
	<hr/>
	<table>
	<tr>
		<th>Line Item Description</th>
		<th>Amount</th>
	</tr>
	<#list invoice.lineItems as line>
		<tr>
			<td>${line.inspectionTime?string("MM/dd/yyyy hh:mm a")} - ${line.inspectionAddress} (web booking fee)</td>
			<td>$${line.amount}</td>
		</tr>
	</#list>
	</table>

</div>

</body>
</html>
